<?php

use yii\db\Migration;

/**
 * Handles the creation of table `goods_category`.
 */
class m170330_044836_create_goods_category_table extends Migration
{
    /**
     * @inheritdoc
     */
    public function up()
    {
        $this->createTable('goods_category', [
            'id' => $this->primaryKey(3)->unsigned(),
            'tree' => $this->integer(3)->defaultValue(0)->notNull()->comment('树的编号'),
            'lft' => $this->integer(5)->unsigned()->notNull()->defaultValue(0)->comment('左边界'),
            'rgt' => $this->integer(5)->unsigned()->notNull()->defaultValue(0)->comment('右边界'),
            'depth' => $this->integer(3)->unsigned()->defaultValue(0)->notNull()->comment('级别'),
            'name' => $this->string(50)->notNull()->defaultValue(0)->comment('名称'),
            'parent_id'=>$this->integer(3)->unsigned()->notNull()->comment('上级分类'),
            'intro'=>$this->text()->comment('简介'),
            //'cateImg'=>$this->string()->defaultValue('o.jpg')->comment('商品分类图片'),
        ]);
    }

    /**
     * @inheritdoc
     */
    public function down()
    {
        $this->dropTable('goods_category');
    }
}
